<template>
	<view class="page-index" style="padding-bottom: 160rpx;">
		<image :src="$wanlshop.oss(dataInfo.avatar)" mode="widthFix" style="width: 100%;display: block;">
		</image>
		<view class="p15">
			<view class="bg-white p12 brs5" style="width: 100%;">
				<view class="u-flex u-f-jsb">
					<view class="u-line-2 c3 fz15 u-font-bold">{{dataInfo.shopname}}</view>
				</view>
				<view class="fz12 c9 u-flex mt12">
					<u-icon name="clock" class="mr5" size="30"></u-icon>
					{{dataInfo.time}}
				</view>
				<view class="fz12 c9 u-flex mt10">
					<u-icon name="map" class="mr5" size="30"></u-icon>
					{{dataInfo.address}}
				</view>
			</view>
			<view class="fz12 c9 u-flex mt15 p12 bg-white  brs5">
				<rich-text :nodes="dataInfo.bio"></rich-text>
			</view>
		</view>
		<view class="fixed-bottom">
			<view class="btn" @click="toAdd(dataInfo)">立即预约</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				dataInfo: {}
			}
		},
		onShareAppMessage(e) {},
		onShareTimeline() {

		},
		onShow() {},
		onLoad(e) {
			if (e.id) {
				this.id = e.id
			}
			this.$nextTick(() => {
				this.initData()
			})
		},

		methods: {

			toAdd(item){
				uni.setStorageSync('storeInfo',JSON.stringify(item))
				uni.switchTab({
					url:'/pages/store/add'
				})
			},
			initData() {


				uni.request({
					url: '/wanlshop/index/shopDetail',
					data: {
						id: this.id
					},
					
					complete: res => {
						console.log(res, 1212)
						if (res.res.code === 1) {
								//详情正则
								res.res.data.bio = res.res.data.bio.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (
									match, capture) => {
									var img =
										`<img style="display: block; max-width: 100%;" src="${this.$wanlshop.oss(capture, 500, 0)}">`;
									return img;
								});
							this.dataInfo=res.res.data
						}
					}
				});

			},
		}
	}
</script>

<style lang="scss">
	.act-img {
		width: 382rpx;
		height: 188rpx;
		display: block;
	}

	.search-select {
		background: #fff;
		border-radius: 50rpx;
		padding: 12rpx 18rpx;
		width: 150rpx;
	}

	page {}

	.page-content {
		background: #fff;
		border-radius: 30rpx;
		position: relative;
		top: -30rpx;
	}

	.ic-play {
		background: rgba(0, 0, 0, 0.2);
		border-radius: 20rpx;
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;

	}

	.module-banner {
		height: 280rpx;


	}

	.module-activity {}

	// .index-act{
	// 	.act1{
	// 		height: 188rpx;
	// 		background:url('https://dl.nhbdic.com/admin-api/infra/file/18/get/image/bg-act1.png');
	// 		background-size: cover;
	// 	}
	// 	.act2{
	// 		height: 188rpx;
	// 		background:url('https://dl.nhbdic.com/admin-api/infra/file/18/get/image/bg-act.png');
	// 		background-size: cover;
	// 	}
	// }
	.bg-img-block {
		background: #1a2a7e;
		height: 500rpx;
	}

	.module-user {
		padding-bottom: 50rpx;
		background: #1a2a7e;
	}

	.btn-view {
		background: #1a2a7e;
		color: #fff;
		border-radius: 50rpx;
		padding: 10rpx 20rpx;

	}
</style>